package com.umeng.analytics.pro;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Locale;

public abstract class y {
    private final int a;
    private final int b;
    private final String c;
    private List d;
    private bl e;

    public y(String arg2) {

        this.a = 10;
        this.b = 20;
        this.c = arg2;
    }

    public String a(String arg5) {
        String v0 = null;
        if(arg5 != null) {
            String v1 = arg5.trim();
            if(v1.length() != 0 && !"0".equals(v1) && !"unknown".equals(v1.toLowerCase(Locale.US))) {
                v0 = v1;
            }
        }

        return v0;
    }

    public void a(bl arg1) {
        this.e = arg1;
    }

    public void a(bm arg5) {
        this.e = (bl) arg5.d().get(this.c);
        List v0 = arg5.i();
        if(v0 != null && v0.size() > 0) {
            if(this.d == null) {
                this.d = new ArrayList();
            }

            Iterator v1 = v0.iterator();
            while(v1.hasNext()) {
                Object v0_1 = v1.next();
                if(!this.c.equals(((bk)v0_1).a)) {
                    continue;
                }

                this.d.add(v0_1);
            }
        }
    }

    public void a(List arg1) {
        this.d = arg1;
    }

    public boolean a() {
        return this.g();
    }

    public String b() {
        return this.c;
    }

    public boolean c() {
        boolean v0 = this.e == null || this.e.i() <= 20 ? true : false;
        return v0;
    }

    public bl d() {
        return this.e;
    }

    public List e() {
        return this.d;
    }

    public abstract String f();

    private boolean g() {
        String v3_1;
        boolean v1 = false;
        bl v2 = this.e;
        if(v2 == null) {
            v3_1 = null;
        }
        else {
            v3_1 = v2.c();
        }

        int v0 = v2 == null ? 0 : v2.i();
        String v4 = this.a(this.f());
        if(v4 != null && !v4.equals(v3_1)) {
            if(v2 == null) {
                v2 = new bl();
            }

            v2.a(v4);
            v2.a(System.currentTimeMillis());
            v2.a(v0 + 1);
            bk v0_1 = new bk();
            v0_1.a(this.c);
            v0_1.c(v4);
            v0_1.b(v3_1);
            v0_1.a(v2.f());
            if(this.d == null) {
                this.d = new ArrayList(2);
            }

            this.d.add(v0_1);
            if(this.d.size() > 10) {
                this.d.remove(0);
            }

            this.e = v2;
            v1 = true;
        }

        return v1;
    }
}

